<template>
  <div class="wrap">
    <header>
      <span @click="go">&lt;</span>
      <h3>资讯频道</h3>
    </header>
    <main>
      <div class="zixun">
        <div v-for="(item,index) in ziXunList" :key="index" class="zixunlist">
          <img :src="item.img" alt />
          <div class="font">
            <h4>{{item.introduce}}</h4>
            <p>{{item.num}}天前</p>
          </div>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      ziXunList: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    go() {
      this.$router.go(-1);
    },
    getList() {
      axios({
        url: "/api/getList",
        method: "post"
      }).then(res => {
        // console.log(res);
        this.ziXunList = res.data.data;
      });
    }
  }
};
</script>

<style lang="scss">
.wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  width: 100%;
  height: 50px;
  background: rgb(72, 72, 225);
  display: flex;
  width: 100%;
  height: 50px;
  align-items: center;
  text-align: center;
  span {
    padding-left: 5%;
  }
  h3 {
    padding-left: 35%;
  }
}
main {
  flex: 1;
  overflow-y: scroll;
  .zixun {
    .zixunlist {
      display: flex;
      padding: 10px;
      img {
        width: 100px;
        height: 100px;
        border-radius: 10px;
      }
      .font {
        padding-left: 10px;
        h4 {
          font-size: 16px;
        }
        p{
          font-size: 14px;
          padding-top: 25px;
        }
      }
    }
  }
}
</style>